//
//  CoreData+Additions.h
//  
//
//  Created by Mathieu Tozer on 2/07/07.
//  Copyright 2007 plasq. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface NSNumber (MTExtensions)
+ (float)randomFloatFrom: (float)min to: (float)max;
@end

@interface NSMutableSet (CRUDExtensions)
- (void)removeObjectsFromArray:(NSArray *)array;
@end



@interface NSManagedObjectContext (MTExtensions)
- (NSManagedObject *)insertNewObjectOfEntity:(NSString *)entityName;
- (NSArray *)executeFetchRequestWithEntity:(NSString *)entityName andPredicate:(NSPredicate *)predicate error:(NSError * *)error;
- (void)deleteAllObjectsInArray:(NSArray *)array;
- (NSManagedObject *)objectWithIDKey:(NSString *)key;
- (NSArray *)objectIDKeysForObjects:(NSArray *)array;
- (NSArray *)objectsWithObjectIDKeys:(NSArray *)array;
- (NSManagedObject *)findOrCreateObjectOfEntityType:(NSString *)entityName usingKey:(NSString *)key andValue:(NSString *)value;
@end

@interface NSManagedObject (MTAdditions)
- (NSString *)objectIDKey;
@end

@interface NSImage (PhotoClip)
- (NSImage *) imageFromRect: (NSRect) rect;
@end
